LIB=netlink-user
SRCS=$(shell find . -maxdepth 1 | grep '\.c$$')
OBJS=$(SRCS:%.c=%.o)
CFLAGS=-g -fPIC
INCLUDE=-I./
all:${LIB}
${LIB}:${OBJS}
	gcc $(CFLAGS) $(SRCS) $(INCLUDE) -o $(LIB)
%.o:%.c
	gcc -c $^ $(INCLUDE) -o $@ 
clean:
	rm -f $(LIB) $(OBJS)

INSTALL_PATH=/usr/sbin
ifdef DESTDIR
	INSTALL_PATH=$(DESTDIR)/sbin
else ifdef prefix
	INSTALL_PATH=$(prefix)/sbin
else
	INSTALL_PATH=/usr/sbin
endif

install:
	mkdir -p $(INSTALL_PATH)
	install -m 755 $(LIB) $(INSTALL_PATH)/
uninstall:
	rm -f (INSTALL_PATH)/$(LIB)

